# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AnalyticsData.V1beta.Model.RunPivotReportResponse do
  @moduledoc """
  The response pivot report table corresponding to a pivot request.

  ## Attributes

  *   `aggregates` (*type:* `list(GoogleApi.AnalyticsData.V1beta.Model.Row.t)`, *default:* `nil`) - Aggregation of metric values. Can be totals, minimums, or maximums. The returned aggregations are controlled by the metric_aggregations in the pivot. The type of aggregation returned in each row is shown by the dimension_values which are set to "RESERVED_".
  *   `dimensionHeaders` (*type:* `list(GoogleApi.AnalyticsData.V1beta.Model.DimensionHeader.t)`, *default:* `nil`) - Describes dimension columns. The number of DimensionHeaders and ordering of DimensionHeaders matches the dimensions present in rows.
  *   `kind` (*type:* `String.t`, *default:* `nil`) - Identifies what kind of resource this message is. This `kind` is always the fixed string "analyticsData#runPivotReport". Useful to distinguish between response types in JSON.
  *   `metadata` (*type:* `GoogleApi.AnalyticsData.V1beta.Model.ResponseMetaData.t`, *default:* `nil`) - Metadata for the report.
  *   `metricHeaders` (*type:* `list(GoogleApi.AnalyticsData.V1beta.Model.MetricHeader.t)`, *default:* `nil`) - Describes metric columns. The number of MetricHeaders and ordering of MetricHeaders matches the metrics present in rows.
  *   `pivotHeaders` (*type:* `list(GoogleApi.AnalyticsData.V1beta.Model.PivotHeader.t)`, *default:* `nil`) - Summarizes the columns and rows created by a pivot. Each pivot in the request produces one header in the response. If we have a request like this: "pivots": [{ "fieldNames": ["country", "city"] }, { "fieldNames": "eventName" }] We will have the following `pivotHeaders` in the response: "pivotHeaders" : [{ "dimensionHeaders": [{ "dimensionValues": [ { "value": "United Kingdom" }, { "value": "London" } ] }, { "dimensionValues": [ { "value": "Japan" }, { "value": "Osaka" } ] }] }, { "dimensionHeaders": [{ "dimensionValues": [{ "value": "session_start" }] }, { "dimensionValues": [{ "value": "scroll" }] }] }]
  *   `propertyQuota` (*type:* `GoogleApi.AnalyticsData.V1beta.Model.PropertyQuota.t`, *default:* `nil`) - This Google Analytics property's quota state including this request.
  *   `rows` (*type:* `list(GoogleApi.AnalyticsData.V1beta.Model.Row.t)`, *default:* `nil`) - Rows of dimension value combinations and metric values in the report.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :aggregates => list(GoogleApi.AnalyticsData.V1beta.Model.Row.t()) | nil,
          :dimensionHeaders =>
            list(GoogleApi.AnalyticsData.V1beta.Model.DimensionHeader.t()) | nil,
          :kind => String.t() | nil,
          :metadata => GoogleApi.AnalyticsData.V1beta.Model.ResponseMetaData.t() | nil,
          :metricHeaders => list(GoogleApi.AnalyticsData.V1beta.Model.MetricHeader.t()) | nil,
          :pivotHeaders => list(GoogleApi.AnalyticsData.V1beta.Model.PivotHeader.t()) | nil,
          :propertyQuota => GoogleApi.AnalyticsData.V1beta.Model.PropertyQuota.t() | nil,
          :rows => list(GoogleApi.AnalyticsData.V1beta.Model.Row.t()) | nil
        }

  field(:aggregates, as: GoogleApi.AnalyticsData.V1beta.Model.Row, type: :list)
  field(:dimensionHeaders, as: GoogleApi.AnalyticsData.V1beta.Model.DimensionHeader, type: :list)
  field(:kind)
  field(:metadata, as: GoogleApi.AnalyticsData.V1beta.Model.ResponseMetaData)
  field(:metricHeaders, as: GoogleApi.AnalyticsData.V1beta.Model.MetricHeader, type: :list)
  field(:pivotHeaders, as: GoogleApi.AnalyticsData.V1beta.Model.PivotHeader, type: :list)
  field(:propertyQuota, as: GoogleApi.AnalyticsData.V1beta.Model.PropertyQuota)
  field(:rows, as: GoogleApi.AnalyticsData.V1beta.Model.Row, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.AnalyticsData.V1beta.Model.RunPivotReportResponse do
  def decode(value, options) do
    GoogleApi.AnalyticsData.V1beta.Model.RunPivotReportResponse.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AnalyticsData.V1beta.Model.RunPivotReportResponse do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
